 
import { UtilsHelper } from "utils/position/UtilsHelper";
import { PathFinderManager } from "../PathFinderManager";
import { ACostDecorate } from "./ACostDecorate";

/**
 * 跨星门设置
 */
export class ACreepCrossPortal extends ACostDecorate
{
    decorate(manager:PathFinderManager,roomName: string, costs: CostMatrix,opt:IPathFinderOpt): CostMatrix 
    {
        const room = Game.rooms[roomName]
        // 判断房间是否是存在星门的房间
        if(room && UtilsHelper.IsHillway(roomName))
        {
            // 不在我的房间.
            room.find(FIND_STRUCTURES).forEach(struct => {
                if( struct.structureType === STRUCTURE_PORTAL)
                {
                    costs.set(struct.pos.x, struct.pos.y, 0);
                }
            })
        }
        return  costs
    }

}